package com.springcloud.feigndemo.config

import com.springcloud.feigndemo.config.properties.Properties
import com.springcloud.feigndemo.pojo.User
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.PropertySource

@Configuration
@PropertySource('classpath:feign.properties')
@EnableConfigurationProperties(Properties.class)//启用配置属性
class RootConfig {

    @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
    @Bean
    User user(Properties properties)
    {

        def user = new User()
        user.info=properties.info.value
        user.name=properties.name
        user
    }

}
